package com.qf.stub;

import com.qf.pojo.Order;
import com.qf.service.OrderService;
import com.qf.service.UserService;

import java.util.List;

public class OrderServiceStub implements OrderService {

    private OrderService orderService;

    /*
        这里通过构造方法传进来的对象，就是当前容器中的那个代理对象
     */
    public OrderServiceStub(OrderService orderService) {
        this.orderService = orderService;
    }

    @Override
    public List<Order> findByUid(Integer uid) throws InterruptedException {
        //做前置额外处理，处理成功后，发起远程调用，失败就不调用
        if (uid > 100){
            throw  new RuntimeException("没有这个用户....");
        }
        return orderService.findByUid(uid);
    }
}
